home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility1 / gs261src.zip / GDEVMSWN.H < prev    next >
C/C++ Source or Header  |  1993-05-13  |  4KB  |  109 lines

  1. /* Copyright (C) 1989, 1992, 1993 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* gdevmswn.h */
  20. /* Shared definitions for Microsoft Windows 3.n drivers */
  21. #include "windows_.h"
  22. #include <shellapi.h>
  23. #include "string_.h"
  24. #include <stdlib.h>
  25. #include "gx.h"
  26. #include "gserrors.h"
  27. #include "gxdevice.h"
  28. #include "gp_mswin.h"
  29.  
  30. typedef struct gx_device_win_s gx_device_win;
  31.  
  32. /* Utility routines in gdevmswn.c */
  33. LPLOGPALETTE win_makepalette(P1(gx_device_win *));
  34. int win_nomemory(P0());
  35. void win_update(P1(gx_device_win *));
  36.  
  37. /* Device procedures shared by all implementations. */
  38. /* Implementations may wrap their own code around _open and _close. */
  39. dev_proc_open_device(win_open);
  40. dev_proc_sync_output(win_sync_output);
  41. dev_proc_output_page(win_output_page);
  42. dev_proc_close_device(win_close);
  43. dev_proc_map_rgb_color(win_map_rgb_color);
  44. dev_proc_map_color_rgb(win_map_color_rgb);
  45. dev_proc_put_props(win_put_props);
  46. dev_proc_get_xfont_procs(win_get_xfont_procs);
  47.  
  48. /* Common part of the device descriptor. */
  49.  
  50. #define win_proc_copy_to_clipboard(proc)\
  51.   void proc(P1(gx_device_win *))
  52.  
  53. #define win_proc_repaint(proc)\
  54.   void proc(P8(gx_device_win *, HDC, int, int, int, int, int, int))
  55.  
  56. #define win_proc_alloc_bitmap(proc)\
  57.   int proc(P2(gx_device_win *, gx_device *))
  58.  
  59. #define win_proc_free_bitmap(proc)\
  60.   void proc(P1(gx_device_win *))
  61.  
  62. #define gx_device_win_common\
  63.     int nColors;\
  64.         /* Implementation-specific procedures */\
  65.     win_proc_copy_to_clipboard((*copy_to_clipboard));\
  66.     win_proc_repaint((*repaint));\
  67.     win_proc_alloc_bitmap((*alloc_bitmap));\
  68.     win_proc_free_bitmap((*free_bitmap));\
  69.         /* Handles */\
  70.     HWND hwndimg;\
  71.     HWND hwndimgchild;\
  72.     HPALETTE himgpalette;\
  73.     LPLOGPALETTE limgpalette;\
  74.     HDC hdctext;\
  75.         /* Window scrolling stuff */\
  76.     int cxClient, cyClient;\
  77.     int cxAdjust, cyAdjust;\
  78.     int nVscrollPos, nVscrollMax;\
  79.     int nHscrollPos, nHscrollMax;\
  80.     BOOL update, timer
  81. /* The basic window device */
  82. struct gx_device_win_s {
  83.     gx_device_common;
  84.     gx_device_win_common;
  85. };
  86.  
  87. /* Initial values for width and height */
  88. #define INITIAL_RESOLUTION 96
  89. #define INITIAL_WIDTH (INITIAL_RESOLUTION * 85 / 10 + 1)
  90. #define INITIAL_HEIGHT (INITIAL_RESOLUTION * 11 + 1)
  91.  
  92. /* A macro for casting the device argument */
  93. #define wdev ((gx_device_win *)dev)
  94.  
  95. /* RasterOp codes */
  96. #define rop_write_at_1s 0xE20746L    /* BitBlt: write brush at 1's */
  97. #define rop_write_at_0s 0xB8074AL    /* BitBlt: write brush at 0's */
  98. #define rop_write_0_at_1s 0x220326L    /* BitBlt: ~S & D */
  99. #define rop_write_0_at_0s 0x8800C6L    /* BitBlt: S & D */
  100. #define rop_write_1s 0xFF0062L        /* write 1's */
  101. #define rop_write_0s 0x000042L        /* write 0's */
  102. #define rop_write_pattern 0xF00021L    /* PatBlt: write brush */
  103.  
  104. /* Compress a gx_color_value into an 8-bit Windows color value, */
  105. /* using only the high order 5 bits. */
  106. #define win_color_value(z)\
  107.   ((((z) >> (gx_color_value_bits - 5)) << 3) +\
  108.    ((z) >> (gx_color_value_bits - 3)))
  109.